package shuashuami.hb.com.adapter;

import android.content.Context;
import android.graphics.Color;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;

import java.util.List;

import shuashuami.hb.com.entity.agent.ClickerBean;
import shuashuami.hb.com.entity.agent.OrderBean;
import shuashuami.hb.com.hbclient.R;
import shuashuami.hb.com.hdlibrary.glid.GlidUtil;

/**
 * <b>类   名：</b>${TYPE_NAME} <br/>
 * <b>类描述：</b> <br/>
 * <b>创建人：</b>zhangqi<br/>
 * <b>创建时间：</b>2017/6/23<br/>
 * <b>修改人：</b>zhangqi<br/>
 * <b>修改时间：</b>2017/6/23<br/>
 * <b>修改备注：</b><br/>
 *
 * @version 1.0.0<br/>
 */
public class DistributeCenterAdapter2 extends BaseAdapter {

    private List<OrderBean> mResource;
    private Context mContext;
    private LayoutInflater mInflater;
    private GlidUtil glidUtil;


    public DistributeCenterAdapter2(Context context, List<OrderBean> lists){
        this.mContext=context;
        this.mResource=lists;
        mInflater=LayoutInflater.from(context);
        glidUtil = new GlidUtil(context);
    }

    @Override
    public int getCount() {
        return mResource.size();
    }

    @Override
    public Object getItem(int position) {
        return mResource.get(position);
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        ViewHolder holder=null;
        if(convertView==null){
            holder=new ViewHolder();
            convertView=mInflater.inflate(R.layout.item_click_manager2,null);
            holder.imghead= (ImageView) convertView.findViewById(R.id.item_click_imghead);
            holder.txtname= (TextView) convertView.findViewById(R.id.item_click_txtname);
            holder.txtBtn= (TextView) convertView.findViewById(R.id.item_click_txtstatue);
            holder.txtmsg= (TextView) convertView.findViewById(R.id.item_click_txtmsg);
            convertView.setTag(holder);
        }else{
            holder= (ViewHolder) convertView.getTag();
        }
        OrderBean info=mResource.get(position);
        glidUtil.uploadCircle(info.getAvatar(), holder.imghead, R.mipmap.ic_launcher);
        holder.txtname.setText(info.getUsername());




        return convertView;
    }


    class ViewHolder{
        ImageView imghead;
        TextView txtname;
        TextView txtmsg;
        TextView txtBtn;
    }
}
